package com.zqf.test;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class SetCamera extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public SetCamera() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		this.doPost(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setCharacterEncoding("utf-8");
		String setCamera = request.getParameter("jsonpcallback");
		String resolution_x=request.getParameter("resolution_x");
		String resolution_y=request.getParameter("resolution_y");
		String size=request.getParameter("size");
		String quliaty=request.getParameter("quliaty");
		String format=request.getParameter("format");
		
		System.out.println("resolution_x: "+resolution_x+",resolution_y: "+resolution_y+",size: "+size+",quliaty: "+quliaty+",format: "+format);
		
		String info="{\"code\":\"code\",\"msg\":\"msg\"}";
		info=setCamera+"("+info+")";
		System.out.println(info);
		response.getWriter().print(info);
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}
